Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some optimization steps (plus bug fixes) #3

Open
wants to merge 18 commits into
base: new_tag_strategy
Choose a base branch
from

Conversation

mashehu
Copy link

@mashehu mashehu commented Apr 8, 2024

No description provided.

Co-authored-by: Matthias Hörtenhuber <[email protected]>
changed_files = changed_files + detect_include_files(
changed_files, include_files
)
changed_files = changed_files + detect_include_files(changed_files, include_files)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm my black says no?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ruff > black 😉

Copy link
Owner

@adamrtalbot adamrtalbot Apr 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruff seems to accept both, which I don't understand because it goes over 88 characters?

.github/python/find_changed_files.py Outdated Show resolved Hide resolved
# compare two branches
diff_index = branch1_commit.diff(branch2_commit)
# Get the diff between two branches
diff = repo.git.diff(f"{branch1}..{branch2}", name_only=True)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is synonymous, this gets all changes between the branches rather than the changes introduced by the PR (I think?)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some tests and it should work. I'm not a fan of string formatting for args in a function though.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also returning strings separated by newlines is 🤮

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, can ignore it then, made for me more sense, because it's closer to the cli git (but not very pythony, I agree)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we just make this an independent action 🤔 Future stuff.

Copy link
Author

@mashehu mashehu Apr 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even past future stuff 😁 nf-core/tools#725

.github/python/find_changed_files.py Outdated Show resolved Hide resolved
@adamrtalbot
Copy link
Owner

adamrtalbot commented Apr 8, 2024

My black seems to format things differently to yours? (and Ruff, which should use the same rules).

> black --version
black, 24.3.0 (compiled: no)
Python (CPython) 3.12.2

Ruff:

ruff 0.3.5

@mashehu
Copy link
Author

mashehu commented Apr 8, 2024

My black seems to format things differently to yours? (and Ruff, which should use the same rules).

> black --version
black, 24.3.0 (compiled: no)
Python (CPython) 3.12.2

Ruff:

ruff 0.3.5

what's your prettier version?

@adamrtalbot
Copy link
Owner

what's your prettier version?

v3.2.5

Comment on lines +49 to +54
if os.path.basename(os.path.dirname(os.path.dirname(test_yml))) not in [
"modules",
"config",
"subworkflows",
]:
modname = f"{os.path.basename(os.path.dirname(os.path.dirname(test_yml)))}/{os.path.basename(os.path.dirname(test_yml))}"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's got to be a better way here 😆

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this file should be included in this PR?

if len(words) == 2 and re.match(
r"^(workflow|process|function|pipeline|tag)$", words[1]
):
result.append(line)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong, result is a dict.

nf_test_files = detect_nf_test_files(changed_files)
lines = process_files(nf_test_files)
result = convert_nf_test_files_to_test_types(lines)
result = convert_nf_test_files_to_test_types(lines, args.types) # Get only relevant results (specified by -t)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PEP8 says 72 characters max, this is 110.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think this sort of thing should go in a different PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, just added it, because I saw we started to have quite a bit of python code and wanted to harmonize it with our other python tooling.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open a PR to nf-core/modules, so we can test and review in isolation. When I merged this it was broken and didn't even know where to start looking.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamrtalbot
Copy link
Owner

cherry-picked: faf952e

@adamrtalbot
Copy link
Owner

adamrtalbot commented Apr 9, 2024

I've had to revert faf952e because it didn't work

See here: https://github.com/nf-core/modules/actions/runs/8613055957/job/23603598762

@mashehu
Copy link
Author

mashehu commented Apr 9, 2024

I've had to revert faf952e because it didn't work

See here: https://github.com/nf-core/modules/actions/runs/8613055957/job/23603598762

yes, needs a checkout action first. commit incoming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants